function findLexSmallestString(s, a, b) {
  const n = s.length;
  const visited = new Set();
  const queue = [s];
  visited.add(s);
  let minStr = s;

  while (queue.length > 0) {
    const current = queue.shift();

    // 更新最小字符串
    if (current < minStr) {
      minStr = current;
    }

    // 生成累加操作后的字符串
    let addStr = "";
    for (let i = 0; i < n; i++) {
      if (i % 2 === 1) {
        // 奇数下标，执行累加
        const num = parseInt(current[i], 10);
        const newNum = (num + a) % 10;
        addStr += newNum.toString();
      } else {
        // 偶数下标，保持不变
        addStr += current[i];
      }
    }

    // 如果累加后的字符串未访问过，加入队列
    if (!visited.has(addStr)) {
      visited.add(addStr);
      queue.push(addStr);
    }

    // 生成轮转操作后的字符串
    const k = b % n; // 轮转b位等效于轮转b%n位
    const rotatedStr = current.slice(n - k) + current.slice(0, n - k);

    // 如果轮转后的字符串未访问过，加入队列
    if (!visited.has(rotatedStr)) {
      visited.add(rotatedStr);
      queue.push(rotatedStr);
    }
  }

  return minStr;
}
